package emu.decvices.ppu;

import emu.decvices.bus.BusDevice;

/**
 * 连接在PPU总线上的，用于记录NameTables
 */
public class VRAM extends BusDevice {
    private int[] data = new int[0x800];

    @Override
    public int fromDeviceRead(int address) {
        if(address>=0x2000&address<0x2800){
            address -=0x2000;
            return this.data[address]&0xFF;
        }
        return -1;
    }

    @Override
    public boolean toDeviceWrite(int address, int data) {
        if(address>=0x2000&address<0x2800){
            address -=0x2000;
            this.data[address] = data;
            return true;
        }
        return false;
    }
}
